<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/6/1 0001
 * Time: 下午 11:03
 */


if(!function_exists('test')) {
    function test()
    {
      return 111;
    }
}


if ( ! function_exists('get_ip'))
{
    function get_ip()
    {
        $CI =& get_instance();
        if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
            $ip=$_SERVER['HTTP_CLIENT_IP'];
        } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
            $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
        }else {
            $ip=$_SERVER['REMOTE_ADDR'];
        }
        return $ip;
    }
}


if(!function_exists('jumpurl')) {
    function jumpurl($messge,$second,$jumpUrl)
    {
        if(empty($jumpUrl)){
            $jumpUrl = $_SERVER['HTTP_REFERER'];
        }

$second = $second*1000;
$content = <<<JSTEXT
<html>
<head>
<style type="text/css" >
body{
     font-family: "Microsoft YaHei" ! important;
}
/*灰色遮罩层*/
.fade{
    width:100%;
    height:100%;
    background:rgba(0, 0, 0, 0.5);
    position: fixed;
    left: 0;
    top: 0;
    z-index: 99;
}
/*弹出层*/
.succ-pop{
    width: 400px;
    height: 200px;
    background: #f2f2f2;
    position: fixed;
    left: 50%;
    top: 50%;
    margin-left: -200px;
    margin-top: -150px;
    z-index: 999;
    border-radius: 5px;
}
.succ-pop h3.title{
    margin:0px 0px;
    height:40px;
    line-height:40px;
    text-align: center;
    background: green;
    font-size: 22px;
    color: #fff;
    width:100%;
}
.succ-pop div.content{
    margin-top:20px;
    margin-left:20px;
    line-height:20px;
    text-align: left;
    color:#666;
    font-size: 16px;
    width:100%;
}
.succ-pop div.footer{
    position: absolute;
    bottom:20px;
    margin-left:20px;
    line-height:20px;
    text-align: left;
    color:green;
    font-size: 16px;
    width:100%;
}
</style>
</head>
<body>
<div class="fade"></div>
<div class="succ-pop">
    <h3 class="title"> SUCCESS </h3>
    <div class="content">{$messge}</div>
    <div class="footer"><a href="{$jumpUrl}">系统将在2秒后自动转跳,如不能请点击这里</a></div>
</div>
</html>
<script type='text/javascript'>
function redirect(){
window.location.href='{$jumpUrl}';
}
setTimeout('redirect()',{$second});
</SCRIPT>
</div>
JSTEXT;

        echo $content;
    }
}




if(!function_exists('jumpurlerror')) {
    function jumpurlerror($messge,$second,$jumpUrl)
    {
        if(empty($jumpUrl)){
            $jumpUrl = $_SERVER['HTTP_REFERER'];
        }

        $second = $second*1000;
        $content = <<<JSTEXT
<html>
<head>
<style type="text/css" >
body{
     font-family: "Microsoft YaHei" ! important;
}
/*灰色遮罩层*/
.fade{
    width:100%;
    height:100%;
    background:rgba(0, 0, 0, 0.5);
    position: fixed;
    left: 0;
    top: 0;
    z-index: 99;
}
/*弹出层*/
.succ-pop{
    width: 400px;
    height: 200px;
    background: #f2f2f2;
    position: fixed;
    left: 50%;
    top: 50%;
    margin-left: -200px;
    margin-top: -150px;
    z-index: 999;
    border-radius: 5px;
}
.succ-pop h3.title{
    margin:0px 0px;
    height:40px;
    line-height:40px;
    text-align: center;
    background: red;
    font-size: 22px;
    color: #fff;
    width:100%;
}
.succ-pop div.content{
    margin-top:20px;
    margin-left:20px;
    line-height:20px;
    text-align: left;
    color:#666;
    font-size: 16px;
    width:100%;
}
.succ-pop div.footer{
    position: absolute;
    bottom:20px;
    margin-left:20px;
    line-height:20px;
    text-align: left;
    color:red;
    font-size: 16px;
    width:100%;
}
</style>
</head>
<body>
<div class="fade"></div>
<div class="succ-pop">
    <h3 class="title"> FAILED </h3>
    <div class="content">{$messge}</div>
    <div class="footer"><a href="{$jumpUrl}">系统将在2秒后自动转跳,如不能请点击这里</a></div>
</div>
</html>
<script type='text/javascript'>
function redirect(){
window.location.href='{$jumpUrl}';
}
setTimeout('redirect()',{$second});
</SCRIPT>
</div>
JSTEXT;

        echo $content;
    }
}


